package cloud.agileframework.common.util.collection;

import cloud.agileframework.common.util.clazz.TypeReference;
import cloud.agileframework.common.util.object.ObjectUtil;
import com.alibaba.fastjson2.JSONReader;
import com.alibaba.fastjson2.reader.ObjectReader;

import java.lang.reflect.Type;
import java.util.Set;

public class SortedSetReader implements ObjectReader<Set> {
    @Override
    public Set readObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) {
        Object value = jsonReader.readAny();
        return ObjectUtil.to(value, new TypeReference<>(fieldType));
    }
}
